/* eslint-disable jsdoc/no-restricted-syntax */
/* eslint-disable jsdoc/check-types */
import * as EK from "es-toolkit/string";

const { camelCase } = EK;

const name = "ngTakeover";

/**
 * @overload
 * @param {string} nameOrObj
 * @param {ng.IComponentOptions} options
 * @returns {ng.IModule}
 */
/**
 * @overload
 * @param {Object<string, ng.IComponentOptions>} nameOrObj
 * @returns {ng.IModule}
 */
/**
 * @this {ng.IModule}
 * @param {string|Object<string, ng.IComponentOptions>} nameOrObj
 * @param {ng.IComponentOptions=} options
 * @returns {ng.IModule}
 */
function TakeoverNgComponent(nameOrObj, options) {
  if (typeof nameOrObj === "string") {
    return this.component(camelCase(nameOrObj), /** @type {*} */ (options));
  }
  return this.component(nameOrObj);
}
/**
 * @param {ng.IModule} mod
 */
function takeoverMethod(mod) {
  mod.component = TakeoverNgComponent.bind(mod);
}

export { takeoverMethod };
